#include "../src/SDLtoolkit/widgets/TextScrollBarElement.h"
#include "../src/common/utils/Logger.h"

void testScrollBarText() {

	SDLEngine* engine = new SDLEngine("prueba scroll bar text", 800, 600, 24);

	engine->start();

	Surface* aux = engine->getMainSurface();

	TextScrollBarElement* scrollBarText1 = new TextScrollBarElement(20, 50, &aux, "Scroll1", "./res/img/scrollbartext",0,0);
	TextScrollBarElement* scrollBarText2 = new TextScrollBarElement(20, 70, &aux, "Scroll2", "./res/img/scrollbartext",0,0);

	Event* eventoloco = new Event();

	bool quit = false;
	SDL_Event event;
	while (quit == false) {
		while (SDL_PollEvent(&event)) {
			eventoloco->setEvent(event);
			scrollBarText1->handleEvent(*eventoloco);
			scrollBarText2->handleEvent(*eventoloco);
			engine->refreshScreen();

			if (eventoloco->getType() == Quit) {
				quit = true;
			}
		}
	}

	engine->stop();

	Logger::log("Tests", "ScrollBarText", "Finalizado.");

}
